Skip to content

Fix: correct db access#307

Merged
S1ro1 merged 1 commit into
mainfrom
fix/api-db
Jun 28, 2025
Merged

Fix: correct db access#307
S1ro1 merged 1 commit into
mainfrom
fix/api-db

Conversation

@S1ro1
Copy link
Copy Markdown
Member

@S1ro1 S1ro1 commented Jun 28, 2025

Fixes api issues.

Copilot AI review requested due to automatic review settings June 28, 2025 13:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes API issues by correcting the database access patterns.

  • Removed the context manager decorator from get_db and now return the database directly.
  • Updated the prepare_submission call to pass the entire backend instead of just backend.db.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/discord-cluster-manager/api/main.py Removed contextmanager usage in get_db and adjusted exception format.
src/discord-cluster-manager/api/api_utils.py Changed prepare_submission parameter from backend.db to backend.
Comments suppressed due to low confidence (2)

src/discord-cluster-manager/api/main.py:73

  • The get_db function no longer functions as a context manager; please update its docstring to reflect that it now directly returns the database instance.
    return backend_instance.db

src/discord-cluster-manager/api/api_utils.py:142

  • Ensure that prepare_submission is updated accordingly to handle the full backend object instead of just the database property, as this change modifies the expected parameter type.
        req = prepare_submission(submission, backend)

Copy link
Copy Markdown
Collaborator

@ngc92 ngc92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@S1ro1 S1ro1 merged commit bc5ab2c into main Jun 28, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants